﻿using System.Text.RegularExpressions;

namespace Infrastructure.Utility.Core.CommonUtility
{
    public static class PrivacyUtility
    {
        public static string FormatMobile(string mobile)
        {
            return string.IsNullOrEmpty(mobile) ? "" : Regex.Replace(mobile, "(\\d{3})\\d{4}(\\d{4})", "$1****$2");
        }

        public static string FormatIdCard(string idCard)
        {
            return string.IsNullOrEmpty(idCard) ? "" : Regex.Replace(idCard, "(\\d{6})\\d*([0-9a-zA-Z]{4})", "$1********$2");
        }
    }
}